import { sveltekit } from '@sveltejs/kit/vite';
// import autoImport from 'sveltekit-autoimport';
import Unocss from 'unocss/vite';
// import wasmPack from 'vite-plugin-wasm-pack';

/** @type {import('vite').UserConfig} */

const config = {
	plugins: [
		Unocss(),
		// autoImport({
		// 	components: [{ name: './src/lib', flat: true }],
		// 	// some frequently used modules
		// 	module: {
		// 		svelte: ['onMount', 'createEventDispatcher']
		// 	},

		// 	// manually import
		// 	mapping: {
		// 		API: `import API from '~/src/api'`,
		// 		Icon: `import * as Icon from '$components/icon'`,
		// 	},

		// 	// autoimport only for .svelte files
		// 	// and only search for .svelte files inside components
		// 	include: ['**/*.(md|svelte)'],

		// 	// node_modules is ignored by default
		// 	exclude: ['**/node_modules/**'],
		// }),
		sveltekit(),
		// wasmPack('./wasm')
	],
	ssr: {
		noExternal: ['three', 'troika-three-text']
	},
	test: {
		include: ['src/**/*.{test,spec}.{js,ts}']
	}
};

export default config;
